home *** CD-ROM | disk | FTP | other *** search
/ PC World 2007 December / PCWorld_2007-12_cd.bin / domacnost a kancelar / autoit / autoit-v3-setup.exe / Examples / Helpfile / _WordCreate.au3 < prev    next >
Text File  |  2007-09-08  |  2KB  |  38 lines

  1. ; *******************************************************
  2. ; Example 1 - Create a Microsoft Word window and open a document file
  3. ; *******************************************************
  4. ;
  5. #include <Word.au3>
  6. $oWordApp = _WordCreate (@ScriptDir & "\Test.doc")
  7.  
  8. ; *******************************************************
  9. ; Example 2 - Attempt to attach to an existing word window with the specified document open.
  10. ;               Create a new word window and open that document if one does not already exist.
  11. ; *******************************************************
  12. ;
  13. #include <Word.au3>
  14. $oWordApp = _WordCreate (@ScriptDir & "\Test.doc", 1)
  15. ; Check @extended return value to see if attach was successful
  16. If @extended Then
  17.     MsgBox(0, "", "Attached to Existing Window")
  18. Else
  19.     MsgBox(0, "", "Created New Window")
  20. EndIf
  21.  
  22. ; *******************************************************
  23. ; Example 3 - Create a word window with a new blank document
  24. ; *******************************************************
  25. ;
  26. #include <Word.au3>
  27. $oWordApp = _WordCreate ()
  28.  
  29. ; *******************************************************
  30. ; Example 4 - Create an invisible word window, open a document,
  31. ;               append some text, and quit saving changes.
  32. ; *******************************************************
  33. ;
  34. #include <Word.au3>
  35. $oWordApp = _WordCreate (@ScriptDir & "\Test.doc", 0, 0)
  36. $oDoc = _WordDocGetCollection ($oWordApp, 0)
  37. $oDoc.Range.insertAfter ("This is some text to insert.")
  38. _WordQuit ($oWordApp, -1)